import { Callout } from '@/components'

# Migrate TanStack Query imports

<Callout type='info'>

- We recommend upgrading to `@tanstack/react-query@5` when using `@suspensive/react-query` with `@tanstack/react-query@4`.
- Starting from `@suspensive/react-query-4@3.3.0`, `queryOptions`, `infiniteQueryOption`, `useSuspenseQuery`, and `useSuspenseQueries` have been deprecated. (`@tanstack/react-query@4.40.0` officially supports `useSuspenseQuery` and `queryOptions`.)

</Callout>

Any API in `@suspensive/react-query` that is officially provided by `@tanstack/react-query` will be marked as `deprecated`.  
This is because `@suspensive/react-query` offers the same APIs such as Suspense Hooks and `queryOptions`/`infiniteQueryOption`, and we want to encourage developers to use the official `@tanstack/react-query` APIs first.

```bash filename="Terminal"
npx @suspensive/codemods tanstack-query-import .
```

This codemod automatically transforms import paths from `@suspensive/react-query` to `@tanstack/react-query`.

For example:

```tsx /@suspensive/
import { queryOptions } from '@suspensive/react-query'
import { useSuspenseQuery } from '@suspensive/react-query-5' // The versioned package is also transformed!
```

Transforms into:

```tsx /@tanstack/
import { queryOptions } from '@tanstack/react-query'
import { useSuspenseQuery } from '@tanstack/react-query'
```
